﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：吕海乐
    //
    // 文件名：AuditNoticeList.cs
    // 文件功能描述：待审核公告
    // 创建标识：吕海乐2009-05-24
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.DrugTrade.BLLFactory;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.Model;

namespace HZ.DrugTrade.Web.Hospitals.MessageManage
{
    public partial class AuditNoticeList : BasePage
    {
        IBLL_Message im = Factory.BLL_Message();

        public AuditNoticeList()
        {
            this.ModuleNo = "";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                rblNoticeType_SelectedIndexChanged(sender, e);               
            }
        }

 
        /// <summary>
        /// 绑定公告
        /// </summary>
        /// <param name="NoticeType">N2待审核,N3已发布,N1已接收</param>
        private void SetBind(string NoticeType)
        {
            int temp;
            //AspNetPager1.PageSize = Constants.GRIDVIEW_PAGE_SIZE;
            IList<Model.View.Notice> lstNotice = new List<Model.View.Notice>();
            switch (rblNoticeType.SelectedValue)
            {
                case "N2"://待审核
                    lstNotice = im.GetAuditNotice(new Model.Query.Notice() { SortFields = "SendTime DESC" }, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out temp); 
                    break;
                case "N3"://已发布
                    lstNotice = im.GetNotice(new Model.Query.Notice() { SortFields = "SendTime DESC" }, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out temp); 
                    break;
                case "N1"://已接收
                    lstNotice = im.GetRecievedNotice(new Model.Query.Notice() { SortFields = "SendTime DESC" }, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out temp); 
                    break;
                default:
                    break;
            }
            gvwNotice.DataSource = lstNotice;
            gvwNotice.DataBind();
        }

        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            rblNoticeType_SelectedIndexChanged(sender, e);
        }

        /// <summary>
        /// 切换通告类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rblNoticeType_SelectedIndexChanged(object sender, EventArgs e)
        {
          SetBind(rblNoticeType.SelectedValue);
        }
    }
}
